<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定位</title>
    <style>
        body {
            width: 300px;
            height: 200px;
            margin: auto;
        }

        .text {
            background-color: rgba(102, 204, 255, 0.5);
            position: relative;
            top: 2em;
            left: 3em;
        }

        span {
            position: relative;
            background-color: #39C5BB;
            top: -1em;
            left: -1em;
        }

        .juedui {
            border: 1px dashed red;
            width: 200px;
            height: 100px;
            position: relative;
        }

        .jue {
            position: absolute;
            /* left: 10px;
            top: 30px; */
            right: -1em;
            overflow: hidden;
            bottom: 2em;
        }

        .guding {
            position: fixed;
            right: 35em;
            bottom: 10em;
        }

        .ding {
            font-size: 22px;
        }

        .top {
            top: 0;
            position: fixed;
            background-color: #39C5BB;
            width: 1500px;
            left: 0;
        }

        .bottom {
            bottom: 0;
            position: fixed;
            background-color: aqua;
            width: 1500px;
            left: 0;
        }

        .side-left {
            left: 0;
            position: fixed;
            background-color: blueviolet;
            height: 500px;
            top: 3em;
        }

        .side-right {
            right: 0;
            position: fixed;
            background-color: blueviolet;
            height: 500px;
            top: 3em;
        }
    </style>
</head>

<body>
    <h1>相对定位</h1>
    <div class="text">定位测试</div>
    <span>固定测试</span>,定位测试，定位测试，定位测试
    <h1>绝对定位</h1>
    <div class="juedui">
        <div class="jue">
            绝对定位
        </div>
    </div>
    <h1>固定定位</h1>
    <div class="ding">
        <div class="guding">固定定位</div>
        <div style="clear: both;"></div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
        <div class="top">置顶</div>
        <div class="bottom">置底</div>
        <div class="side-left">左侧边</div>
        <div class="side-right">右侧边</div>
    </div>
</body>

</html>